package com.example.dynamicdatasource.controller;

import com.example.dynamicdatasource.entities.Teacher;
import com.example.dynamicdatasource.entities.User;
import com.example.dynamicdatasource.service.DemoService;
import com.example.dynamicdatasource.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author mqb
 * @date 2021/8/9 20:27
 */
@RestController
public class DynamicController {
    @Autowired
    DemoService demoService;

    @Autowired
    TestService testService;

    @GetMapping("/test")
    public User selectUser(Long id) {
        return testService.selectOne(id);
    }

    @GetMapping("/demo")
    public Teacher selectTeacher(Long id) {
        return demoService.selectOne(id);
    }
}
